#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll limit=1,l=0;
const int N=3e6+5,p=998244353,g=3,gi=332748118;
ll a[N],b[N],r[N];

ll qsm(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)res=res*a%p;
		b>>=1;
		a=a*a%p;
	}
	return res;
}

void NTT(ll a[],int type){
	for(int i=0;i<limit;i++){
		if(i<r[i])swap(a[i],a[r[i]]);
	}
	for(int mid=1;mid<limit;mid<<=1){
		ll wn=qsm(type==1?g:gi,(p-1)/(mid<<1));
		for(int j=0,R=mid<<1;j<limit;j+=R){
			ll w=1;
			for(int k=0;k<mid;k++,w=(w*wn)%p){
				int x=a[j+k],y=w*a[j+k+mid]%p;
				a[j+k]=(x+y)%p;
				a[j+k+mid]=(x-y+p)%p;
			}
		}
	}
}

void solve(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++){
    	cin>>a[i];
    	// a[i]=(a[i]+p)%p;
    }
    for(int i=0;i<=m;i++){
    	cin>>b[i];
    	// b[i]=(b[i]+p)%p;
    }
    while(limit<=n+m){
    	limit<<=1;
    	l++;
    }
    for(int i=0;i<limit;i++){
    	r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
    }
    NTT(a,1);
    NTT(b,1);
    for(int i=0;i<limit;i++){
    	a[i]=(a[i]*b[i])%p;
    }
    NTT(a,-1);
    ll inv=qsm(limit,p-2);
    for(int i=0;i<=n+m;i++){
    	cout<<(a[i]*inv)%p<<' ';
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}